from datetime import datetime

from sqlalchemy import Column, String, DateTime

from api.utils.base import Base


class Knowledgebase(Base):
    __tablename__ = "t_knowledgebase"
    id: str = Column(String, primary_key=True)
    create_date: str = Column(DateTime, default=datetime.now, comment="创建时间")
    update_date: str = Column(DateTime, comment="更新时间")
    avatar: str = Column(String, comment="头像")
    tenant_id: str = Column(String, comment="租户id")
    name: str = Column(String, comment="知识库名称")
    description: str = Column(String, comment="描述")
    embd_id: str = Column(String, comment="embedding模型id")
    permission: str = Column(String, comment="权限")
    created_by: str = Column(String, comment="创建人")
    doc_num: str = Column(String, comment="文档数量", default="0")
    token_num: str = Column(String, comment="token数量", default="0")
    chunk_num: str = Column(String, comment="分块数量", default="0")
    similarity_threshold: str = Column(String, comment="相似度阈值", default="0.9")
    vector_similarity_weight: str = Column(String, comment="向量相似度权重",  default="0")
    parser_id: str = Column(String, comment="解析器id")
    parser_config: str = Column(String, comment="解析器配置")
    pagerank: str = Column(String, comment="pagerank")
    status: str = Column(String, comment="状态", default="1")